#!/bin/bash
stat=""
info=""
datetime=`date +%s`
hostname=`hostname -s`
Judge=0
repolist=`cat /etc/init.d/lustre  |grep "nms check"|awk -F : '{print $2}'`


function mount_l() {
                #/bin/mount -l > /tmp/mount_l_tmp
                #Temp=`grep $2 /tmp/mount_l_tmp |grep $1`
                Temp=`/bin/mount -l|grep -w $2 |grep $1`
                if [ "t$Temp" == "t" ]
                then
                        Judge=1
                        Fail_name="${Fail_name} ${choice}"
                else
                        Ok_name="${Ok_name} ${choice}"
                fi

                #continue

}



for choice in $Lmount
do
        case $choice in
        besfs)                                             ###
                mount_l  rw "50.181"
                ;;

        besfs4)                                             ###
                mount_l  rw "$choice"
                ;;

        bes3fs)
                mount_l  rw "$choice"
                ;;

        besfs2)
                mount_l  rw "$choice"
                ;;

        publicfs)
                mount_l  rw "$choice"
                ;;

        dybfs)
                mount_l  rw "$choice"
                ;;

        scratchfs)
                mount_l  rw "50.55"
                ;;

        workfs)
                mount_l  r "$choice"  #can not ro because login nodes are rw
                ;;

        cefs)
                mount_l  rw "$choice"
                ;;

        junofs)
                mount_l  rw "$choice"
                ;;

        dyfs2)
                mount_l  rw "dybfs2"
                ;;

        hpcfs)
                mount_l  rw "$choice"
                ;;
        sharefs)
                mount_l  rw "$choice"
                ;;
        lhaasofs)
                mount_l  rw "$choice"
                ;;
        lhmtfs)
                mount_l  rw "$choice"
                ;;
        gecamfs)
                mount_l  rw "$choice"
                ;;
        hxmtfs)
                mount_l  rw "$choice"
                ;;
        besfs5)
                mount_l  rw "$choice"
                ;;
        workfs2)
                mount_l  r "$choice" #can not ro because login nodes are rw
                ;;
        *)
                mount_l  rw "$choice"
                ;;
        esac

done

/bin/rm -f /tmp/mount_l_tmp

if [ $Judge -eq 1 ]
then
        #echo "mount -l $Fail_name  wrong status"
	stat="error"
        echo $0" time:$datetime execnode:$hostname stat:$stat info:'mount -l $Fail_name  wrong status'"
        exit 2
else
       # echo " $Ok_name are OK "
	stat="ok"
	echo $0" time:$datetime execnode:$hostname stat:$stat info:'$repolist mount status are all ok'"
        exit 0
fi






